<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.fick.hibernate.model.*,java.util.*,java.text.SimpleDateFormat" %>
<%@ page import="com.fick.hibernate.dao.*"%>
<html>
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加浮动窗口</title>
<link href="images/jiahao.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/check.js"></script>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js" defer="defer"></script>
<script type="text/javascript">
<!--
			    function CheckForm() {
					if(document.form1.webName.value=="")
					{
						alert("网址名字不能为空");
						document.form1.webName.focus();
						return false;
					}
					if(document.form1.webURL.value=="")
					{
						alert("网址URL不能为空");
						document.form1.webURL.focus();
						return false;
					}
					if(document.form1.pics.value=="" && document.getElementById("haveImg")==null)
					{
						alert("必须上传一幅图片");
						document.form1.pics.focus();
						return false;
					}
					if(form1.linkOrder.value!="" && form1.linkOrder.value!="0" && !isInt(form1.linkOrder.value,false)){
						alert("请输入正确的顺序!");
						form1.linkOrder.focus();
						return false;
					}
				}
//-->
</script>
</head>

<body>
<table width="100%"  height="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100%" align="center" valign="top" background="images/main_bj.gif" bgcolor="#FBFCFD"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="23" align="left" valign="middle" background="images/main_top.gif"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="20" height="23">&nbsp;</td>
            <td width="400" height="23" align="left" valign="middle" class="ts_lmdh2">添加浮动窗口</td>
          </tr>
        </table></td>
      </tr>
    </table>
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="20"></td>
        </tr>
      </table>
	  
	  
	 <%
	 String id=request.getParameter("id");
	 Link link=null;
	 if(id!=null && id.trim().length()>0){
		 link=new LinkDAO().findById(Integer.parseInt(id));
	 }
	 %> 
<form name="form1" id="form1" action="<%=request.getContextPath()%>/admin/managerLink.do?method=<%=link==null?"addLink":"upLink" %>" enctype="MULTIPART/FORM-DATA" method="post" onSubmit="return CheckForm();" />
      <input type="hidden" name="id" value="<%=id==null?"":id %>"/>
      <input type="hidden" name="type" value="888">
      <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">网址名：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="webName" id="webName" size="30" value="<%=link==null?"":link.getWebName() %>" type="text" class="ts_box3"/>
		  </td>
        </tr>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">网址url：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="webURL" id="webURL" size="30" value="<%=link==null?"":link.getWebUrl() %>"  type="text" class="ts_box3"/>
		  </td>
        </tr>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">到期时间：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
          <%
            SimpleDateFormat   sdf   =   new   SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 
          	Date date = new Date();
          	String dateStr = sdf.format(date);
          	if(link != null)
          		dateStr = link.getToDate().toString();
          	
           %>
		  <input name="toDate" id="toDate" class="Wdate"
				type="text" size="22" value="<%=dateStr %>"
				onClick="WdatePicker({skin:'default',dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
		  </td>
        </tr>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">浮动图片：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
          
          <%
          if(link!=null && link.getImg()!=null){
        	  out.println("<img id='haveImg' height='50' width='50' src='"+request.getContextPath()+"/"+link.getImg()+"'>");
          }
          %>
		  <input type="file" name="pics" id="pics" value="" type="text" class="ts_box3"/>
		  </td>
        </tr>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">顺序：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="linkOrder" id="linkOrder" size="30" value='<%=link==null?"":link.getLinkOrder() %>'  type="text" class="ts_box3" maxlength="4"/>
		  </td>
        </tr>
       
        <tr>
          <td height="30" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF">
		  <input type="submit" name="Submit" value="提交">
		  <input  type="button" value="返回" onClick="javascript:history.go(-1);">
		  </td>
        </tr>
      </table>
</form>	  
	  
	  
	  
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="45" align="center" valign="middle">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
